<%@ page language="java" import="java.util.*,cn.ac.cintcm.dataconverge.util.Constants,com.hs.core.utils.*" pageEncoding="UTF-8"%>
<%@ page import ="cn.ac.cintcm.dataconverge.researchsubject.domain.*,cn.ac.cintcm.dataconverge.researcher.domain.*" %> 
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
Subject obj = (Subject)request.getAttribute("obj");
Long  subjectId = (Long)request.getAttribute("subjectId");
String imagePath = path + "/index/"; 

%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
    <title><%=Constants.APP_TITLE %></title>  
	<script language="javascript" type="text/javascript" src="<%=path %>/js/My97DatePicker/WdatePicker.js"></script>
	<script language="javascript" src="<%=path %>/index/Scripts/script.js"></script>
	<script language="javascript" src="<%=path %>/js/common.js"></script>
	<link href="<%=path %>/index/Themes/com/style.css" type="text/css" rel="stylesheet"></link>
	<script src='<%=basePath%>dwr/engine.js'></script>
     <script src='<%=basePath%>dwr/util.js'></script> 
     <script src='<%=basePath%>dwr/interface/subject.js'></script>   
    <script type="text/javascript">
   	    function uploadFile(){ 
	            if(isNull(form1.jfmc.value)){
	            	alert("请填写经费名称");
	            	return;
	            }
	    		form1.submit();
	    } 
    
    		function addrow(obj){
			 if(obj.delid==0){
				    obj.value="删除";
				    obj.title="删除";
				    obj.delid="1";
				    
					var newTr = dataTable.insertRow(obj.parentElement.parentElement.rowIndex+1);
					var newTd1 = newTr.insertCell();
					var newTd2 = newTr.insertCell();
					newTd1.align="right";
					newTd1.className= "fim_l";			
					newTd1.innerText = ' 选择文件     '; 	
					newTd2.className= "fim_r";	
					newTd2.innerHTML= "&nbsp;<input type='file' style='width:50%' name='textfield2' class='com_textbox' onpaste='return false;' onkeydown='this.blur();return false;' oncontextmenu='return false;'/>&nbsp;<INPUT type='button' value=' 增加 ' title='添加'  delid='0' onclick='addrow(this);' class='com_btn2'>";
			   }else{
			    del(obj);
			   }
		 }
 function del(obj){
	 //parentElement.parentElement.rowIndex
	 if(obj.parentElement.parentElement.rowIndex!=undefined)
	 {
	 	document.getElementById("dataTable").deleteRow(obj.parentElement.parentElement.rowIndex);
	 }
  }
  	function deleteDoc(docId,location) {
		var bln = window.confirm("确定要删除经费吗？", "确定", "取消");
		if(bln == true) {
		  form1.action="fund.htm?action=delFund&fundId="+docId+"&subjectId=<%=obj.getId()%>";
		  form1.submit();
		}
	}
	function CallBackForDelete(data){
	   alert(data);
	   window.location.replace(window.location.href);
	}
    </script>
</head>
<body class="rtm_body"> 
         <table cellpadding="0" cellspacing="0" border="0" width="100%">
        <tr>
            <td>
                <div class="content">
                    <table width="*" cellpadding="0" cellspacing="1" class="dg_borderstyle" id="Table4">
                        <tr>
                            <td class="dg_headerstyle" width="5%">
                               	序号</td>
                            <td class="dg_headerstyle" >
                             	经费类型</td>
                            <td class="dg_headerstyle" >
                                 经费名称</td>
                                  <td class="dg_headerstyle" >
                                 中央经费</td>
                                  <td class="dg_headerstyle" >
                                 地方经费</td>
                                  <td class="dg_headerstyle" >
                                 企业经费</td>
                                  <td class="dg_headerstyle" >
                                 银行经费</td>
                                   <td class="dg_headerstyle" >
                                 其他经费</td>
                                  <td class="dg_headerstyle" >
                                 经费合计</td> 
                            <td class="dg_headerstyle">
                                删除</td> 
                        </tr>
                        <%if(obj!= null && obj.getFunds() != null &&obj.getFunds().size()!=0){
                        		Set set = obj.getFunds();
                        		Iterator it = set.iterator();
                        		int i = 0;
                        		Double count=0d;
                        		while(it.hasNext()){
                        			SubjectFund doc = (SubjectFund)it.next(); 
                        			i++; 
                         %>
                        <tr class="dg_alternatingitemstyle">
                            <td align="center"><%=i %></td>
                            <td align="center" width="5%">
                               <%=doc.getJftype()==null?"":doc.getJftype() %>
                                 
                            </td>
                            <td align="center"  width="15%">
                               <%=doc.getJfmc()==null?"":doc.getJfmc() %>
                                 
                            </td>
                            <td align="center"  width="8%">
                               <%=doc.getJfZy()==null?"0":doc.getJfZy() %>
                                 
                            </td>
                            <td align="center"  width="8%">
                               <%=doc.getJfDf()==null?"0":doc.getJfDf() %>
                                 
                            </td>
                            <td align="center"  width="8%">
                               <%=doc.getJfQy()==null?"0":doc.getJfQy() %>
                                 
                            </td>
                            <td align="center"  width="8%">
                               <%=doc.getJfYh()==null?"0":doc.getJfYh() %>
                                 
                            </td>
                            <td align="center"  width="8%">
                               <%=doc.getJfQt()==null?"0":doc.getJfQt() %>
                                 
                            </td>
                             <td align="center" width="8%" >
                               <%=doc.getJfHj()==null?"0":doc.getJfHj() %>
                                 
                            </td>
                             <td align="center" width="5%">
                                <img src="<%=imagePath %>Themes/com/68design.net_registration1_(delete)_16x16.gif" onclick="javascript:deleteDoc('<%=doc.getId()%>','<%=doc.getId() %>');"
                                    alt="删除" />
                            </td>
                        </tr> 
                        <%}%>
                         
                        
                        <% }else{ %>
                         <tr class="dg_alternatingitemstyle">
                            <td colspan=10 align="center"><font color=red>没有记录</font></td>
                        </tr>  
                        <%} %>
                    </table>  
                </div>
            </td>
        </tr>
    </table> 
    <form name="form1" action="fund.htm?action=addReceiveFund" method="post" >
    <table cellpadding="0" cellspacing="0" width="100%"  height="100%" id="Table8">
        <tr valign="top">
            <td valign="top" height="100%">
                <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" id="Table11">
                    <tr>
                        <td class="idt_main_m">
                            <!------------------ 标题栏 ------------------>
                            <!--- 标题 ---->
                            <table class="idt_tle_mg" cellspacing="0" cellpadding="0" width="100%">
                                <tr  >
                                    <td class="idt_tle_i">
                                        <img id="imgForm6" src="<%=imagePath %>Themes/com/idt_tle_o.gif"></td>
                                    <td class="idt_tle_f1">
                                        添加经费</td>
                                </tr>
                            </table>
                            <!--- 内容 --->
                            <div id="tdForm">
                                <table border="0" cellpadding="0" id="dataTable" cellspacing="1" width="100%" class="com_fieldset_tab">
                                    <input type="hidden" name="subjectid" value="<%=obj==null?"":obj.getId() %>"/>
                                    <tr>
                                        <td class="fim_l" width="15%">
                                            经费类型
                                        </td> 
                                        <td class="fim_r" width="35%">
                                             <input type="text" class="com_textbox" style="width:100%"  name="jflx" />
                                        </td>
                                        <td class="fim_l" width="15%">
                                            经费名称
                                        </td> 
                                        <td class="fim_r" width="35%">
                                             <input type="text" class="com_textbox" style="width:100%"  name="jfmc" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="fim_l">
                                           中央经费
                                        </td> 
                                        <td class="fim_r" >
                                             <input type="text" class="com_textbox" style="width:100%"  name="jfzy" />
                                        </td>
                                        <td class="fim_l">
                                            地方经费
                                        </td> 
                                        <td class="fim_r" >
                                             <input type="text" class="com_textbox" style="width:100%"  name="jfdf" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="fim_l">
                                            企业经费
                                        </td> 
                                        <td class="fim_r" >
                                             <input type="text" class="com_textbox" style="width:100%"  name="jfqy" />
                                        </td>
                                        <td class="fim_l">
                                            银行经费
                                        </td> 
                                        <td class="fim_r" >
                                             <input type="text" class="com_textbox" style="width:100%"  name="jfyh" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="fim_l">
                                            其他经费
                                        </td> 
                                        <td class="fim_r" >
                                             <input type="text" class="com_textbox" style="width:100%"  name="jfqt" />
                                        </td>
                                        <td class="fim_l">
                                            经费合计
                                        </td> 
                                        <td class="fim_r"  >
                                             <input type="text" class="com_textbox" style="width:100%"  name="jfhj" />
                                        </td>
                                    </tr>
                                     
                                    <tr> 
                                        <td class="fim_r" colspan="4" style="width:100%" align="center">
                                           <input type="button" value=" 保 存 "  class="com_btn2"   onclick="javascript:uploadFile();"/>
                                        </td>                           
                                    </tr> 
                                </table> 
                                <table cellspacing="0" cellpadding="0" width="100%" class="idt_bottom_mg" border="0">
                                    <tr>
                                        <td align="center">
                                           <!--  <input  class="com_btn2" id="Button1" name="save" type="button"  value="上一步">
                                            &nbsp; &nbsp;
                                             <input  class="com_btn2" id="Button1" name="save" type="button" value="下一步">-->
                                        </td>
                                    </tr>
                                </table>
                            </div>
                </table> 
       </td>
       </tr>
       </table>
        
       </form>
</body>
</html>
